#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#define all(e) e.begin(), e.end()
//#define int unsigned long long
#define int long long
using namespace std;

bool jug(const string& str)
{
	int n = str.size();
	if (n == 1)
		return str == "1";
	if (str[0] == '0' && str[1] == '1')
		return false;
	if (str[n - 1] == '0' && str[n - 2] == '1')
		return false;
	return str.find("101") == string::npos;
}

signed main()
{
	int t; cin >> t;
	while (t--)
	{
		int n; cin >> n;
		string str; cin >> str;
		if (jug(str))
		{
			cout << "YES" << endl;
			vector<int> arr(n);
			for (int i = 1; i <= n; ++i) arr[i - 1] = i;
			int l = 0, r = 0;
			while (true)
			{
				while (l != n && str[l] != '0') ++l;
				if (l == n) break;
				r = l;
				while (r + 1 != n && str[r + 1] == '0') ++r;
				//cout << l << ' ' << r << endl;
				for (int i = l, j = r; i < j; ++i, --j) swap(arr[i], arr[j]);
				l = r = r + 1;
			}
			for (auto& e : arr) cout << e << ' '; cout << endl;

		}
		else cout << "NO" << endl;
	}
	return 0;
}


//[1 ~ x-1] x [x+1 ~ y-1] y z [z+1, max]

//6 3 111 5 00000 5 10100 7 0010000 11 00001001100 12 011100010000
